<template>
    <div v-if="Object.keys(goodDataObj).length !== 0">
      <div class="good-info">
      <!-- 商品标题 -->
      <div class="good-title">
        {{goodDataObj.title}}
      </div>
      <!-- 商品价格 -->
      <div class="good-price">
        <span class="now-price">{{goodDataObj.price}}</span>
        <span class="old-price">{{goodDataObj.oldPrice}}</span>
        <span class="active-icon" 
        :style="{background:goodDataObj.discountBgColor}"
        v-if="goodDataObj.discountDesc">{{goodDataObj.discountDesc}}</span>
      </div>
      <!-- 商品：销量，收藏，24小时发货区块 -->
      <div class="good-active">
        <span>{{goodDataObj.columns[0]}}</span>
        <span>{{goodDataObj.columns[1]}}</span>
        <span>{{goodDataObj.services[goodDataObj.services.length - 1].name}}</span>
      </div>
    </div>
      <!-- 商品：服务区块 -->
      <div class="good-serve">
        <span v-for="item in goodDataObj.services.length - 2" 
        :key="item">
          <img :src="goodDataObj.services[item].icon" alt="">
          {{goodDataObj.services[item].name}}
        </span>
      </div>

      
    </div>
</template>

<script>


export default {
  name: 'DetailGoodInfo',
  props: {
    goodDataObj: {
      type: Object,
      default() {
        return {};
      }
    }
  }
}
</script>

<style scoped>
  .good-info{
    padding: 10px 5px;
  }
  /* 商品标题区域 */
  .good-title{
    font-size: 16px;
    font-weight: bold;
    width: 100%;
    line-height: 23px;
    margin-bottom: 10px;
  }
  /* 商品价格区块 */
  .now-price{
    font-size: 28px;
    color: var(--color-tint);
  }
  .old-price{
    text-decoration: line-through;
    font-size: 15px;
    color: rgb(112, 112, 112, .5);
    margin-left: 8px;
  }
  .active-icon{
    font-size: 14px;
    color: #fff;
    padding: 3px 8px;
    border-radius: 15px;
    vertical-align: top;
    margin-left: 5px;
  }
  /* 商品活动 */
  .good-active{
    display: flex;
    margin-top: 30px;
    color: rgba(97, 93, 93, 0.5);
    font-size: 15px;
    box-shadow: 0 1px 1px rgba(97, 93, 93, 0.2);
    padding-bottom: 13px;
  }
  .good-active span:nth-of-type(1){
    flex: 1;
    padding-left: 6px;
  }
  .good-active span:nth-of-type(2){
    flex: 1;
    text-align: center;
  }
  .good-active span:nth-of-type(3){
    flex: 1;
    text-align: right;
    padding-right: 5px;
  }
  .good-serve{
    display: flex;
    justify-content: space-between;

    font-size: 15px;
    padding: 20px 6px 23px;
    box-shadow: 0 5px 5px rgba(97, 93, 93, 0.2);
  }
  .good-serve span{
    flex: 1;
  }
  .good-serve span img{
    width: 15px;

  }
  .good-serve span:nth-of-type(2){
    text-align: center;
  } 
  .good-serve span:nth-last-of-type(1){
    text-align: right;
  } 
</style>